package MyTest;

import java.util.Random;

public class RandomDemo {
    public static void main(String[] args) {
        int[] arr=new int[6];
        Random r = new Random();
        for (int i = 0; i < arr.length; i++) {
            while (true){
                int num=r.nextInt(9)+1;
                boolean b=isU(arr,num);
                if(!b){
                    arr[i]=num;
                    break;
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }


    }
    public static boolean isU(int[] arr,int a){
        for (int i = 0; i < arr.length; i++) {
            if(a==arr[i]){
                return true;
            }
        }
        return false;
    }
}
